
// Copyright (c) 2002 HTHK
package admin.system.rolefunc;

import javax.servlet.*;
import javax.servlet.http.*;

import java.io.*;
import java.sql.*;

import com.ffpc.servlet.*;
import com.ffpc.sql.*;
import com.ffpc.struts.StrutsMessage;

/**
 * A Class class.
 * <P>
 * @author HTHK
 */
public class RoleFuncSearch
  extends DBServlet {

  @Override
protected String perform(  HttpServletRequest request,
                             HttpServletResponse response,
                             StrutsMessage message)
    throws  ServletException,
            IOException,
            SQLException,
            DataException,
            Exception
  {
      RoleFuncBean roleFunc = RoleFuncProcess.createBean();
      roleFunc.setRole_id(request.getParameter("role_id"));
      roleFunc.setFunc_id(request.getParameter("func_id"));
      roleFunc.setRemark(request.getParameter("remark"));
      RoleFuncBean[] roleFuncs = RoleFuncProcess.find(this.getConnection(),roleFunc);
      if (roleFuncs==null || roleFuncs.length==0)
      {
          message.setMessage("No record, please input another criteria.");
          return "system/RoleFuncSearch.jsp";
      }
      else if (roleFuncs.length==1)
      {
          request.setAttribute("roleFunc",roleFuncs[0]);
          return "system/RoleFunc.jsp?formAction=Update";
      }
      else
      {
          request.setAttribute("roleFuncs",roleFuncs);
          return "system/RoleFuncList.jsp";
      }
  }
}


